Mac™ OS Runtime for Java™ (MRJ) is Apple’s Java execution environment based on technology from Sun Microsystems, Inc. The MRJ Software Development Kit (SDK) is a set of tools that application developers can use to:
• Enable a Macintosh application written in C or Pascal to run Java applets and applications
• Access the Java runtime from a Macintosh application using the JManager API
• Allow Java applications to incorporate basic Macintosh functionality using MRJToolkit
• Call Java methods from C and C++
• Call native methods from Java using JDirect
• Build stand-alone Java applications using JBindery
Pre-Release Software
This is pre-release software and, as such, contains known bugs and should not be considered “final” or “finished quality” software. This software is being made available to select developers for the purpose of getting feedback and enabling them to begin development.
The following guidelines should be followed by users of this pre-release software:
1. Please send feedback to <mrj_feedback@apple.com> and bug reports to <mrj_bugs@apple.com>. In bug reports, put “MRJ SDK2.0.1:” at the beginning of the subject line in the email. We do not guarantee a response to feedback or bug reports but we do read them. The web site <http://applejava.apple.com/> has additional information about future releases and problems.
2. You should not call Apple's 800 number(s) regarding pre-release software since our operators have not yet been trained to support it. The web site noted above has the most current information regarding this software.
Installing and Using the SDK
System Requirements
In order to use this software development kit, you need to have a Macintosh development environment that can build the sample code and make use of the include files.
In order to run applications built with the SDK, you need to have MRJ 2.0 installed. Do not mix and match tools from previous SDK pre-releases.
To use Mac OS Runtime for Java you need a PowerPC or 68040 Macintosh. You also need Mac OS 7.6.1 or later, a minimum of 16 MB of RAM and at least 7 MB of free disk space. The Easy Install option will only work on System 8.0 or later. To installer on 7.6.1 use the Custom Install option.
Using Java applets over the Internet requires MacTCP 2.0.4 or later, or OpenTransport 1.1 or later with TCP/IP, and an active Internet connection.
What's Installed
The MRJ 2.0.1 EA1 Installer installs the following items into a folder called MRJ SDK 2.0.1:
• About MRJ SDK 2.0.1*
• JManager*
• Interfaces & Bindings*
• JBindery
• JDirect*
• Libraries*
• License Agreement
• MRJToolkit
• Redistribution
• Tools*
The MRJ 2.0.1 Early Access 1 Installer also installs the following item into your active System Folder.
• MRJSDKClasses.zip* — goes into the MRJClasses folder in the MRJ Libraries folder
* These items contain new files since the last SDK Release.
Using JRI
JRI (Java Runtime Interface) was designed by Netscape to provide access to native code before Sun introduced the more comprehensive JNI (Java Native Interface) interface, which is supported in JDK 1.1.x and beyond. While MRJ 2.0 provides compatibility with the older JRI library, future versions will not. The current JRI support is provided for backwards compatibility only. We strongly advise that any new development use JNI or JDirect as appropriate. This will enable future runtimes to greatly improve their garbage collection and JITC optimization.
Components of the SDK
JManager
• Programming With JManager 2.0 This document explains how to use the JManager 2.0 APIs to embed Java content in Mac OS applications. The JManager 2.0 API lets you access the Java runtime, and provides a mechanism for easily displaying interactive Java applets.
To view the PDF version of the documents, you will need the Adobe Acrobat™ Reader application, which can be found at <http://www.adobe.com/>.
An HTML version of the JManager Reference is available. See <http://applejava.apple.com/> and go to the developers’ section for more information.
MRJToolkit
• Programming With MRJ Toolkit This document describes how to add Macintosh functionality to your Java application. Functionality includes adding an About box, Quit menu item, menu key equivalents, setting document types, and opening documents dropped onto a Java application in the Finder.
• MRJToolkitStubs.zip This file contains the classes that implement Macintosh toolkit functionality.
• MRJToolkitTest This example showing how to use the new MRJToolkit utilities to add Macintosh functionality (such as menu key equivalents) to your Java applications.
Libraries
The Libraries directory contains library files for developing with MRJ:
• JManagerLib: a fat binary that replaces JManagerStubs.PPC and JManagerStubs68k which were CFM shared library stubs. The actual shared libraries are in MRJLibraries (part of the MRJ installed items). When developing applications, you link against this library.
• NativeLibSupport.PPC, NativeLibSupport.68k: A library of “C” functions that abstract knowledge of some MRJ internals, such as memory allocation. Used when using JRI to implement native methods. IMPORTANT NOTE: These two files will be deprecated. See Using JRI for more information.
Includes & Bindings
CIncludes
• JRI.h
• JManager.h
• jni.h
• jni_md.h
• jritypes.h
• jri_md.h
PInterfaces
• JManager.p
JBindery
The JBindery application allows you to create a double-clickable Macintosh application that executes Java code. You can also use JBindery to dynamically run java applications. You can specify parameters, add to the classpath, specify properties and change other settings before executing your Java code. See the document “Using JBindery” in the JBindery folder for more information.
JDirect
• JDirectTalker This is an example showing how to use Apple’s JDirect technology to access APIs imported from code fragments. Note that you need to have the Speech Manager (available from Apple) installed in order to run this example.
• JDirect Note This is a description of the JDirect technology, which allows you to access the Macintosh Toolbox directly from a Java application.
Tools
The Tools folder contains a number of standard Java tools.
JDK Tools
• jar Combines multiple files into a single Java Archive (JAR) file.
• javah Creates C header files and C stub files for a Java class. These files provide the connective glue that allow your code written in the Java Programming Language to interact with code written in other languages like C.
• javac The Java Language Compiler that you use to compile programs written in the Java Programming Language into bytecodes.
• javadoc Generates API documentation in HTML format from Java source code.
• rmic Generates stub and skeleton class files for Java objects implementing the java.rmi.Remote interface.
• javakey Generates digital signatures for archive files and manages the database of entities and their keys and signatures.
Other Tools
• MRJ dcmd for PPC A MacsBug 'dcmd' that provides additional information when debugging Java code.
• Java Diddler A simple java application that allows the user to type in some java statements, and then execute them.
Known Problems
• Do not remove the Text Encodings folder from the System Folder or the Text Encoding Converter file from the Extensions folder. Removing these items may cause problems while using MRJ or using other applications requiring these files.
• Due to a bug in the MetroWerks runtime (a bug which is experienced, apparently, by their java compiler; which they have fixed in CWPro2), java code that is compiled with the MW Java compiler may not have expected values for double constants embedded in their code. This is not an MRJ problem.
• Serialized Object files default to type TEXT. Transferring these files as text files to other systems can introduce CR/LFs that corrupt the files. Be sure to use a file transfer utility that allows you to specify that the file is binary.
• The new JDK tools are double-clickable Java applications and do not yet have droplet functionality. The droplet feature will be added in subsequent releases. An easy workaround is to copy the tool into the directory in which your working, then use relative pathnames.
Java not Fault-tolerant
The Java technology is not fault-tolerant and is not designed, manufactured or intended for use or resale as on-line control equipment in the operation of nuclear facilities, aircraft navigation or communication systems, or air traffic control machines in which the failure of the Java technology or Mac OS Runtime for Java could lead directly to death, personal injury, or severe physical or environmental damage.
Apple, the Apple logo, LaserWriter, MacTCP, Power Macintosh, Mac, and Macintosh are trademarks of Apple Computer, Inc., registered in the U.S. and other countries. PowerPC is a trademark of International Business Machines Corporation, used under license therefrom. Java and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All other product names are trademarks or registered trademarks of their respective holders. Mention of non-Apple products is for information purposes and constitutes neither an endorsement nor a recommendation. Apple assumes no responsibility with regard to the selection, performance, or use of these products.